function out_XP = f_cleanup_Bnoise(X_P_target,fs,certainF,tdur)

ifplot = 0;
L_or_R = 1;

load Protocol_0_0degree
Combined_dual=recorded_sound;
rad = 0.1; % for identifying center
x1=Combined_dual(:,1);
x2=Combined_dual(:,2);
nfft = round(tdur*fs);
% nfft = round(260e-3*fs);
win = hamming(nfft,'periodic');
SL = stft(x1,fs,'Window',win,'FFTLength',nfft);
SR = stft(x2,fs,'Window',win,'FFTLength',nfft);
Combined_stft{1} = stft(Combined_dual(:,1),fs,'Window',win,'FFTLength',nfft);
Combined_stft{2} = stft(Combined_dual(:,2),fs,'Window',win,'FFTLength',nfft);
freqs = (1:nfft)./nfft.*fs;
SL = SL(end/2+1:end,:);
SR = SR(end/2+1:end,:);
if ifplot==1
figure
end
SLR1=Normalize_Both(SL,SR,L_or_R);
for ifreql = 1:length(freqs)/2
    freq = freqs(ifreql);
    if round(freq)==certainF
%         'here'

        X_P = [real(SLR1(ifreql,:))' imag(SLR1(ifreql,:))'];
        out = f_mycenter(X_P,rad);
        F_centers= [out.C1];

        if ifplot==1
        plot(X_P(:,1),X_P(:,2),'b.','Markersize',4);hold on;
        set(gca,'Xtick',-1:0.5:1)
        set(gca,'Ytick',-1:0.5:1)
        title([ num2str(freq), ' Hz'],'fontsize',12);
        xlabel('Real');ylabel('Imag')
        hold on;
        plot(-1:1,[0,0,0],'k', 'LineWidth', 0.5);
        plot([0,0,0],-1:1,'k','LineWidth',0.5)
        axis([-1.1 1.1 -1.1 1.1])
        axis square
        box off
        s=plot(F_centers(1),F_centers(2),'ro');set(s,'markersize',25,'linewidth',2)
        end
        %         pause(0.1)

        %     end % plotting
        %     pause
    end
end % freq

out_XP=[];
for i_time=1:length(X_P_target)
    % B_mask(ifreql,i_time)=1;
    dist = sqrt((X_P_target(i_time,1)-F_centers(1)).^2 + (X_P_target(i_time,2)-F_centers(2)).^2);
    if dist > rad
        out_XP = [out_XP
            X_P_target(i_time,:)];
    end
end
length(X_P_target)
length(out_XP)











